package com.base.core.enums;

/**
 * @author
 * 通用状态
 */
public enum GenderEnum implements CodeEnum{
	/**
	 * 启用
	 */
	MALE(new Byte("1"), "男"),

	/**
	 * 禁用
	 */
	FEMALE(new Byte("2"), "女");


	/**
	 * 类型
	 */
	private final Byte code;

	/**
	 * 描述
	 */
	private final String description;

    GenderEnum(Byte code, String description) {
        this.code = code;
        this.description = description;
    }


    public String getDescription() {
        return this.description;
    }

	@Override
	public Object getCode() {
		return this.code;
	}

	public static Byte getValue(Byte value) {
		GenderEnum[] genderEnums = values();
		for (GenderEnum genderEnum : genderEnums) {
			if (genderEnum.getCode().equals(value)) {
				return (Byte) genderEnum.getCode();
			}
		}
		return null;
	}

	public static String getDesc(Byte value) {
		GenderEnum[] genderEnums = values();
		for (GenderEnum genderEnum : genderEnums) {
			if (genderEnum.getCode().equals(value)) {
				return genderEnum.getDescription();
			}
		}
		return null;
	}
}
